use std::io::Result;
use std::io::{stdin, Write};
use std::net::TcpStream;

fn main() -> Result<()> {
    let mut stream = TcpStream::connect("127.0.0.1:7878")?;
    loop {
        let mut input = String::new();
        let _ = stdin().read_line(&mut input)?;
        let len = stream.write(input.as_bytes())?;
        println!("size:{len}");
        if input.contains("\n") {
            break;
        }
    }
    Ok(())
}
